package com.demo.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.demo.entity.User;
import com.demo.service.UserService;

@Controller @Scope("prototype")
public class UserAction extends BaseAction{

	private static final long serialVersionUID = -8796684324981044424L;

	private User user;
	
	@Resource
	private UserService userService;
	
	public String add(){
		userService.save(user);
		return ADD;
	}
	
	public String find(){
		user = userService.get("1");
		return FIND;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

}
